# -*- coding:utf-8 -*-
"""
Created on 30 Nov 2009
"""
__author__ = 'Ilias Karampatsos'


import datetime as dt
dat = dt.date.today()

def subtract_date(date, year=0, month=0):
    year, month = divmod(year*12 + month, 12)
    if date.month <= month:
        year = date.year - year - 1
        month = date.month - month + 12
    else:
        year = date.year - year
        month = date.month - month
    try:
        return date.replace(year = year, month = month)
    except ValueError:
        return 'Year %s and month %s does not have day %s' % (year,month,date.day)

if __name__=='__main__':
    for i in range(13):
        print subtract_date(dat, month=i)